Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Rendered • View rawDownload


android/README.md v4.5.0-rc.1 (62ba0631) Text, 5.37 KB

MeshChatX Android App

This directory contains the Android app build configuration using Chaquopy to embed the Python MeshChatX server.

Architecture

The app uses a WebView to display the existing Vue.js frontend. The Python server runs in the background via Chaquopy and serves the web interface on T383838https://127.0.0.1:8000.

Build debug APK

Prerequisites:

JDK 17 or newer (required by the Android Gradle Plugin used in this project). On distributions with multiple JDKs, point the build at JDK 17+ (for example T383838JAVA_HOME for the Gradle invocation).
Android SDK with API 34 platform and Build-Tools 34 installed. Set T383838ANDROID_HOME and T383838ANDROID_SDK_ROOT to the SDK root (the same directory for both is fine).
T383838android/vendor/ must contain the Chaquopy vendor wheels (see Updating Android Python ABI Wheels). The build fails fast if this directory is missing or incomplete.
MeshChatX Python sources at the repository root (T383838meshchatx/). The build syncs them into the app before compiling.

SDK licenses:

• Use Command-line Tools T383838sdkmanager, not the legacy T383838tools/bin/sdkmanager from old SDK layouts. The legacy tool loads JAXB classes that were removed from the JDK in Java 11, so running it on JDK 17+ fails with T383838NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema.
• Install Command-line Tools if needed: download the package for your OS from Android Studio command-line tools, extract it so you have T383838cmdline-tools/latest/bin/sdkmanager under T383838ANDROID_HOME (the inner folder is often named T383838latest; see Google’s layout for that zip).
• Accept licenses (writes under the SDK; use sudo if the SDK is root-owned):

T282828
yes | path/to/cmdline-tools/latest/bin/sdkmanager --licenses

• Install missing packages if the build still complains (platform 34, build-tools 34, etc.):

T282828
path/to/cmdline-tools/latest/bin/sdkmanager "platforms;android-34" "build-tools;34.0.0"

Build from the T383838android/ directory:

T282828
./gradlew assembleDebug

Debug APK outputs (ABI splits plus universal) are written under T383838app/build/outputs/apk/debug/, for example:

• T383838app-arm64-v8a-debug.apk
• T383838app-x86_64-debug.apk
• T383838app-universal-debug.apk

Updating Android Python ABI Wheels (Python 3.11)

Use this workflow when a dependency (for example T383838cryptography) requires custom Android wheels for T383838arm64-v8a and T383838x86_64.

1. Build wheels in a Podman Python 3.11 container to avoid host Python mismatches:
• Use T383838docker.io/library/python:3.11-bookworm.
• Mount project root to T383838/work and Android SDK to T383838/opt/android-sdk.
• Export T383838ANDROID_HOME and T383838ANDROID_SDK_ROOT to T383838/opt/android-sdk.
• Example container entry:
T383838podman run --rm --network host -e ANDROID_HOME=/opt/android-sdk -e ANDROID_SDK_ROOT=/opt/android-sdk -v "/opt/android-sdk:/opt/android-sdk" -v "<repo>:/work" -w /work docker.io/library/python:3.11-bookworm bash
2. Keep custom Chaquopy recipes in T383838android/chaquopy-recipes/<package>-<major>/:
• Define package/version in T383838meta.yaml.
• Store source patches in T383838patches/.
3. Build both ABIs with Chaquopy T383838build-wheel.py and place final wheels in T383838android/vendor/.
4. Update T383838android/app/build.gradle T383838pip installs to the new pinned version.
5. Rebuild with T383838./gradlew assembleDebug and verify split outputs:
• T383838app-arm64-v8a-debug.apk
• T383838app-x86_64-debug.apk
• T383838app-universal-debug.apk

Notes:
• For Rust-backed wheels (such as modern T383838cryptography), build inside the container with Rust toolchain available.
• Keep recipe files and patches versioned; keep generated build artifacts untracked.

Custom Recipes and Patches

This project keeps Android-specific Chaquopy recipes in T383838android/chaquopy-recipes/ to bridge gaps between desktop Python dependencies and Android wheel availability.

• T383838cryptography-46
• Purpose: provide Android ABI wheels for T383838cryptography 46.0.7 (T383838arm64-v8a, T383838x86_64) because upstream Chaquopy index only provided older builds.
• T383838patches/openssl_no_legacy.patch: disables OpenSSL legacy provider loading, which is unavailable in the bundled Android OpenSSL runtime.
• T383838patches/pyo3_no_interpreter.patch: enables compatible T383838pyo3 ABI settings for Chaquopy Python 3.11 Android builds.

• T383838aiohttp-3.13
• Purpose: align Android with desktop dependency line (T383838aiohttp 3.13.3) by building fresh ABI wheels with Chaquopy.
• No source patch is required; recipe pins the newer upstream version for Android wheel generation.

• T383838psutil-7.2
• Purpose: align Android with desktop dependency line (T383838psutil 7.2.2) while preserving Android runtime behavior.
• T383838patches/chaquopy.patch: treats T383838android platform as Linux in psutil internals and forces a safe partition enumeration path because T383838/proc/filesystems can be restricted by SELinux on some Android API levels.

• T383838bcrypt-5
• Purpose: tracks attempted upgrade path to desktop-equivalent bcrypt.
• Status: currently not enabled in Android app dependencies; T383838bcrypt==3.1.7 remains pinned for stable APK builds.

License

This directory is part of the main project licensing split:
• project-owned portions: 0BSD
• original upstream MeshChat portions: MIT

See ../LICENSE for full text and notices.


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────